home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / 0929ref.arc / CHAP1 next >
Encoding:
Text File  |  1988-11-08  |  12.0 KB  |  242 lines

  1.  
  2. CHAPTER 1.
  3.                          DOS TECHNICAL INFORMATION
  4.  Programming Technical Reference - IBM
  5.  Copyright 1988, Dave Williams
  6.  
  7.  
  8. SOME HISTORY
  9.  
  10.  Development of MSDOS/PCDOS began in October 1980, when IBM began searching 
  11. the market for an operating system for the yet-to-be-introduced IBM PC.
  12. Microsoft had no real operating system to sell, but after some research licensed
  13. Seattle Computer Products' 86-DOS, which had been written by a man named Tim 
  14. Paterson for use on the company's line of 8086, S100 bus micros. This was 
  15. hurriedly polished up and presented to IBM for evaluation. IBM had originally 
  16. intended to use Digital Research's CP/M operating system, which was the industry
  17. standard at the time. Folklore reports everything from obscure legal 
  18. entanglements to outright snubbing of the IBM representatives by Digital,
  19. irregardless, IBM found itself left with Microsoft's offering of "Microsoft Disk
  20. Operating System 1.0". An agreement was reached between the two, and "IBM PC-DOS
  21. 1.0" was ready for the introduction of the IBM PC in October 1981. IBM subjected
  22. the operating system to an extensive quality-assurance program, found well over
  23. 300 bugs, and decided to rewrite the programs. This is why PC-DOS is copyrighted
  24. by both IBM and Microsoft. 
  25.  
  26.  It is sometimes amusing to reflect on the fact that the IBM PC was not
  27. originally intended to run MSDOS. The target operating system at the end of the
  28. development was for a (not yet in existence) 8086 version of CP/M. On the other
  29. hand, when DOS was originally written the IBM PC did not yet exist! Although
  30. PC-DOS was bundled with the computer, Digital Research's CP/M-86 would probably
  31. have been the main operating system for the PC except for two things - Digital
  32. Research wanted $495 for CP/M-86 (considering PC-DOS was essentially free) and
  33. many software developers found it easier to port existing CP/M software to DOS
  34. than to the new version of CP/M.
  35.  
  36.  MSDOS and PC-DOS have been run on more than just the IBM-PC and clones. There 
  37. was an expansion board for the Apple ][ that allowed one to run (some) well - 
  38. behaved DOS programs. There are expansion boards for the Commodore Amiga 2000,
  39. the Apple MacIntosh II, and the IBM RT PC allowing them to run DOS, and the IBM
  40. 3270 PC, which ran DOS on a 68000 microprocessor. The Atari STs can run an 
  41. emulator program and boot MSDOS.
  42.  
  43.  
  44. Specific Versions of MS/PC-DOS:
  45.  
  46.  DOS version nomenclature: major.minor.minor.  The digit to the left of the 
  47. decimal point indicates a major DOS version change. 1.0 was the first version. 
  48. 2.0 added subdirectories, etc. 3.0 added file handles and network support.
  49.  The first minor version indicates customization for a major application. For 
  50. example, 2.1 for the PCjr, 3.3 for the PS/2s. The second minor version does not 
  51. seem to have any particular meaning.
  52.  
  53.  The main versions of DOS are:
  54.  
  55.  PC-DOS 1.0   October  1981  original release
  56.  PC-DOS 1.1   June     1982  bugfix, double sided drive support
  57.  MS-DOS 1.25  June     1982  for early compatibles
  58.  PC-DOS 2.0   March    1983  for PC/XT, many UNIX-like functions
  59.  PC-DOS 2.1   October  1983  for PCjr, bugfixes for 2.0
  60.  MS-DOS 2.11  October  1983  compatible equivalent to 2.1
  61.  PC-DOS 3.0   August   1984  for PC/AT, network support
  62.  PC-DOS 3.1   November 1984  bugfix for 3.0
  63.  MS-DOS 2.25  October  1985  compatible; extended foreign language support
  64.  PC-DOS 3.2   July     1986  3.5 inch drive support for Convertible
  65.  PC-DOS 3.3   April    1987  for PS/2 series
  66.  
  67.  
  68.  Some versions of MS-DOS varied from PC-DOS in the availible external commands.
  69. Some OEMs only licensed the basic operating system code (the xxxDOS and xxxBIO
  70. programs, and COMMAND.COM) from Microsoft, and either wrote the rest themselves
  71. or contracted them from outside software houses like Phoenix. Most of the 
  72. external programs for DOS 3.x are written in "C" while the 1.x and 2.x utilities
  73. were written in assembly language. Other OEMs required customized versions of 
  74. DOS for their specific hardware configurations, such as Sanyo 55x and early 
  75. Tandy computers, which were unable to exchange their DOS with the IBM version.
  76.  
  77.  At least two versions of DOS have been modified to be run entirely out of ROM.
  78. The Sharp PC5000 had MSDOS 1.25 in ROM, and the Toshiba 1100 and some Tandy 
  79. models have MSDOS 2.11 in ROM.
  80.  
  81.  
  82.  THE OPERATING SYSTEM HIERARCHY
  83.  
  84.  The Disk Operating System (DOS) and the ROM BIOS serve as an insulating layer 
  85. between the application program and the machine, and as a source of services 
  86. to the application program.
  87.  The system heirarchy may be thought of as a tree, with the lowest level being 
  88. the actual hardware. The 8088 or V20 processor sees the computer's address 
  89. space as a ladder two bytes wide and one million bytes long. Parts of this 
  90. ladder are in ROM, parts in RAM, and parts are not assigned. There are also 
  91. 256 "ports" that the processor can use to control devices. 
  92.  The hardware is normally addressed by the ROM BIOS, which will always know
  93. where everything is in its particular system. The chips may usually also be
  94. written to directly, by telling the processor to write to a specific address or
  95. port. This sometimes does not work as the chips may not always be at the same
  96. addresses or have the same functions from machine to machine.
  97.  
  98.  
  99.  
  100.  DOS STRUCTURE
  101.  
  102. DOS consists of four components:
  103.  
  104.  * The boot record
  105.  * The ROM BIOS interface  (IBMBIO.COM or IO.SYS)
  106.  * The DOS program file    (IBMDOS.COM or MSDOS.SYS)
  107.  * The command processor   (COMMAND.COM or aftermarket replacement)
  108.  
  109.  
  110. * The Boot Record
  111.  
  112.  The boot record begins on track 0, sector 1, side 0 of every diskette formatted
  113. by the DOS FORMAT command.  The boot record is placed on diskettes to produce an
  114. error message if you try to start up the system with a nonsystem diskette in 
  115. drive A.  For hard disks, the boot record resides on the first sector of the DOS
  116. partition.  All media supported by DOS use one sector for the boot record.
  117.  
  118.  
  119. * Read Only Memory (ROM) BIOS Interface
  120.  
  121.  The file IBMBIO.COM or IO.SYS is the interface module to the ROM BIOS.
  122. This file provides a low-level interface to the ROM BIOS device routines and 
  123. may contain extensions or changes to the system board ROMs. Some compatibles do
  124. not have a ROM BIOS to extend, and load the entire BIOS from disk. (Sanyo 55x,
  125. Viasyn)
  126.  
  127.  
  128. * The DOS Program File
  129.  
  130.  The actual DOS program is file IBMDOS.COM or MSDOS.SYS. It provides a high-
  131. level interface for user (application) programs. This program consists of file
  132. management routines, data blocking/deblocking for the disk routines, and a
  133. variety of built-in functions easily accessible by user programs.
  134.  When a user program calls these function routines, they accept high-level
  135. information by way of register and control block contents. For device 
  136. operations, the functions translate the requirement into one or more calls to 
  137. IBMBIO.COM or MSDOS.SYS to complete the request.
  138.     
  139.  
  140. * The Command Interpreter
  141.   
  142.  The Command interpreter, COMMAND.COM, consists of these parts:
  143.     
  144. Resident Portion:
  145.  
  146.  The resident portion resides in memory immediately following IBMDOS.COM and its
  147. data area. This portion contains routines to process interrupts 22h (Terminate 
  148. Address), 23h (Ctrl-Break Handler), and 24h (Critical Error Handler), as well as
  149. a routine to reload the transient portion if needed. For DOS 3.x, this portion 
  150. also contains a routine to load and execute external commands, such as files 
  151. with exensions of COM or EXE.
  152.  
  153.  When a program terminates, a checksum is used to determine if the application 
  154. program overlaid the transient portion of COMMAND.COM. If so, the resident 
  155. portion will reload the transient portion from the area designated by COMSPEC= 
  156. in the DOS environment. If COMMAND.COM cannot be found, the system will halt.
  157.  
  158. NOTE: DOS 3.3 checks for the presence of a hard disk, and will default to 
  159.       COMSPEC=C:\. Previous versions default to COMSPEC=A:\. Under some DOS
  160.       versions, if COMMAND.COM is not immediately availible for reloading
  161.       (i.e., swapping to a floppy with COMMAND.COM on it) DOS may crash.
  162.  
  163.  All standard DOS error handling is done within the resident portion of 
  164. COMMAND.COM.  This includes displaying error messages and interpreting the 
  165. replies of Abort, Retry, Ignore, Fail.  
  166.  
  167.   
  168.  An initialization routine is included in the resident portion and assumes
  169. control during startup. This routine contains the AUTOEXEC.BAT file handler and
  170. determines the segment address where user application programs may be loaded.
  171. The initialization routine is then no longer needed and is overlaid by the first
  172. program COMMAND.COM loads.
  173.  
  174.  NOTE: AUTOEXEC.BAT may be a hidden file.
  175.  
  176.  A transient portion is loaded at the high end of memory. This is the command 
  177. processor itself, containing all of the internal command processors and the 
  178. batch file processor. For DOS 2.x, this portion also contains a routine to load
  179. and execute external commands, such as files with extensions of COM or EXE.
  180.  
  181.  This portion of COMMAND.COM also produces the DOS prompt (such as "A>"), reads
  182. the command from the standard input device (usually the keyboard or a batch 
  183. file), and executes the command. For external commands, it builds a command line
  184. and issues an EXEC function call to load and transfer control to the program.
  185.  
  186. NOTE: COMMAND.COM may be a hidden file.
  187.     
  188. NOTE: For Dos 2.x, the transient portion of the command processor contains the
  189.       EXEC routine that loads and executes external commands. For DOS 3.x, the
  190.       resident portion of the command processor contains the EXEC routine. 
  191.  
  192.  
  193.  
  194.   DOS Initialization
  195.  
  196.  The system is initialized by a software reset (Ctrl-Alt-Del), a hardware reset
  197. (reset button), or by turning the computer on. The Intel 80x8x series processors
  198. always look for their first instruction at the end of their address space 
  199. (0FFFF0h) when powered up or reset. This address contains a jump to the first 
  200. instruction for the ROM BIOS.
  201.  Built-in ROM programs (Power-On Self-Test, or POST, in the IBM) check machine
  202. status and run inspection programs of various sorts. Some machines set up a
  203. reserved RAM area with bytes indicating installed equipment (AT and PCjr). 
  204.  The ROM routine looks for a disk drive at A: or an option ROM (usually a hard
  205. disk) at absolute address C:800h. If no floppy drive or option ROM is found, the
  206. BIOS calls int 19h (ROM BASIC if it is an IBM) or displays error message. 
  207.  If a bootable disk is found, the ROM BIOS loads the first sector of information
  208. from the disk and then jumps into the RAM location holding that code. This code
  209. normally is a routine to load the rest of the code off the disk, or to "boot"
  210. the system. 
  211.  The following actions occur after a system initialization:
  212.  
  213.  1.  The boot record is read into memory and given control.    
  214.  
  215.  2.  The boot record then checks the root directory to assure that the first 
  216.      two files are IBMBIO.COM and IBMDOS.COM. These two files must be the 
  217.      first two files, and they must be in that order (IBMBIO.COM first, with 
  218.      its sectors in contiguous order).
  219.      NOTE: IBMDOS.COM need not be contiguous in version 3.x.
  220.  
  221.  3.  The boot record loads IBMBIO.COM into memory.
  222.  
  223.  4.  The initialization code in IBMBIO.COM loads IBMDOS.COM, determines 
  224.      equipment status, resets the disk system, initializes the attached 
  225.      devices, sets the system parameters and loads any installable device 
  226.      drivers according to the CONFIG.SYS file in the root directory (if 
  227.      present), sets the low-numbered interrupt vectors, relocates IBMDOS.COM 
  228.      downward, and calls the first byte of DOS.
  229.      NOTE: CONFIG.SYS may be a hidden file.
  230.  
  231.  5.  DOS initializes its internal working tables, initializes the interrupt
  232.      vectors for interrupts 20h through 27h, and builds a Program Segment 
  233.      Prefix for COMMAND.COM at the lowest available segment. For DOS versions
  234.      3.10 up, DOS initializes interrupt vectors for interrupts 0Fh through 3Fh.
  235.  
  236.  6.  IBMBIO.COM uses the EXEC function call to load and start the top-level
  237.      command processor. The default command processor is COMMAND.COM.
  238.  
  239.  
  240.  
  241.  
  242.